<?php

namespace Usap\Service\Common;
class common
{

    /**
     * 获取
     * 省份
     * 市
     * by省份名
     */
    public function getRegionList($province_name, $level)
    {
        if ($province_name || $level > 1) {
            if ($level == 2) {
                $where = "province_name ='$province_name' and location_level = '$level'";
                $files = 'location_id,city_name';
            } else {
                $where = "city_name ='$province_name' and location_level = '$level'";
                $files = 'location_id,district_name';
            }
        } else {
            $where = " location_level = '$level'";
            $files = 'location_id,province_name';
        }
        return D("Usap/Admin/LocationInfo")->where($where)->getField($files);
    }

}